<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<div class="pad-lr-10">
	<form name="searchform" action="" method="get" >
		<input type="hidden" value="mood_ma" name="m">
		<input type="hidden" value="mood_ma" name="c">
		<input type="hidden" value="init" name="a">
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
				<tr>
					<td>
						<div class="explain-col">
							类型：<?php echo form::select(array('0'=>'请选择','1'=>'机床','2'=>'机身'), $machine_type, 'name="type"')?> 
							<input type="submit" name="search" class="button" value="查看" />
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</form>
	
	<div class="table-list">
		<form name="myform" action="?m=mood_ma&c=mood_ma&a=listorder" method="post">
			<table width="100%" cellspacing="0" class="table-list nHover">
				<thead>
					<tr>
						<th width="40"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
						<th width="40" align="center">ID</th>
						<th width="80" align="center">排序</th>
						<th width="80" align="center">类型</th>
						<th width="80" align="left" >名称</th>
						<th width="200" align="left" >图片</th>
						<th width="100" align="left" >时间</th>
					</tr>
				</thead>
				<tbody>
				<?php
					if(is_array($data) && !empty($data))foreach($data as $k=>$v) {
				?>
					<tr>
						<td align="center" width="40"><input class="inputcheckbox" name="id[]" value="<?php echo $v['id'];?>" type="checkbox"></td>
						<td align="center"><?php echo $v['id'];?></td>
						<td width="80" align="center"><input type='text' name='listorder[<?php echo $v['id']?>]' value="<?php echo $v['listorder']?>" class="input-text-c" size="4"></td>
						<td align="center"><?php if($v['img_type'] == '1') echo "机床";?><?php if($v['img_type'] == '2') echo "机身";?></td>
						<td align="left"><?php echo $v['name'];?></td>
						<td>
						<?php
							$machine_image_db = pc_base::load_model('machine_image_model');
							$info = $machine_image_db->select("img_id='{$v['id']}'",'url');
							foreach($info as $t){
								$url = $t['url'];
								echo "<img src=$url width='60px' height='50px'/>";
								echo "&nbsp;&nbsp;";
							};
						?>
						</td>
						
						<td align="left"><?php echo date("Y-m-d H:i:s",$v['addtime']);?></td>
					</tr>
				<?php
					}
				?>
				</tbody>
			</table>
		
		<div class="btn">
			<label for="check_box"><?php echo L('selected_all')?>/<?php echo L('cancel')?></label>
			<input name='dosubmit' type='submit' class="button" value='<?php echo L('listorder')?>'>&nbsp;
			<input type="submit" class="button" value="<?php echo L('delete')?>" onclick="if(confirm('<?php echo L('confirm', array('message' => L('selected')))?>')){document.myform.action='?m=mood_ma&c=mood_ma&a=del';}else{return false;}"/>
        </div>
		</form>	
		<div id="pages"><?php echo $pages?></div>
	</div>
</div>
</body>
</html>